home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 22 / PC Actual CD 22.iso / SHARE / prog / POVRAY / E-P-O.ZIP / WIRES.INC < prev   
Encoding:
Text File  |  1996-10-31  |  2.5 KB  |  79 lines

  1.  
  2. //------------------------------------------------------------------->
  3. //
  4. // wires.inc
  5. //
  6. // "Easy POV Oven"
  7. //
  8. // Written By: Paul T. Dawson
  9. //             ptdawson@voicenet.com
  10. //             http://www.voicenet.com/~ptdawson
  11. //
  12. // All code and techniques are PUBLIC DOMAIN - have fun with it!
  13. //
  14. //------------------------------------------------------------------->
  15. //
  16. // This file builds the "Wires" object.
  17. //
  18. //------------------------------------------------------------------->
  19. //
  20. // Make a seed just for this object.
  21.  
  22.         #declare R99 = seed(327)
  23.  
  24. //------------------------------------------------------------------->
  25. //
  26. // Build it!
  27.  
  28.         // This controls how many DEGREES each wire segment covers.
  29.         // Lower numbers = shorter segments = tons of memory use!
  30.                 #declare WIRE_INCR = 5
  31.  
  32.         #declare Wires = union {
  33.  
  34.         // Black plastic connector at starting side.
  35.         box { < 12.2-0.4, -0.4, -0.4 > < 14.4+0.4, 0.4, 2 > pigment{Gray10} }
  36.  
  37.         #declare BUNCH = 1 #while ( BUNCH <= 12 )
  38.  
  39.         #if ( mod(BUNCH, 4) = 0 ) #declare This_Pig=pigment {Green } #end
  40.         #if ( mod(BUNCH, 4) = 1 ) #declare This_Pig=pigment {Black } #end
  41.         #if ( mod(BUNCH, 4) = 2 ) #declare This_Pig=pigment {Red   } #end
  42.         #if ( mod(BUNCH, 4) = 3 ) #declare This_Pig=pigment {Yellow} #end
  43.  
  44.         // Starting point.
  45.         #declare Base_Vec = < 12, 0, 0 > + < (0.2*BUNCH), 0, 0 >
  46.         #declare Old_Vec = Base_Vec
  47.  
  48.         #declare A = WIRE_INCR #while ( A <= 170 )
  49.  
  50.                 // Add some wobble to starting point..
  51.                         #declare Base_Vec = Base_Vec +
  52.                                 < (rand(R99)*0.4)-0.2,
  53.                                   (rand(R99)*0.4)-0.2, 0 >
  54.  
  55.                 // Spin around in a [half] circle.
  56.                         #declare New_Vec = vrotate ( Base_Vec, <0,A,0> )
  57.  
  58.                 cylinder { New_Vec, Old_Vec, 0.1 pigment{This_Pig} }
  59.  
  60.                 #declare Old_Vec = New_Vec
  61.  
  62.         #declare A = A + WIRE_INCR #end
  63.  
  64.         // Even them out at the end!
  65.         #declare Final_Vec = < -12, 0, 0 > + < (-0.2*BUNCH), 0, 0 >
  66.         cylinder { Old_Vec, Final_Vec, 0.1 pigment{This_Pig} }
  67.  
  68.         #declare BUNCH = BUNCH + 1 #end
  69.  
  70.         // Black plastic connector at end.
  71.         box { < -12.2+0.4, -0.4, -0.4 > < -14.4-0.4, 0.4, 2 > pigment{Gray10} }
  72.  
  73.         } // End of union.
  74.  
  75. //------------------------------------------------------------------->
  76. //
  77. // End of this file.
  78.  
  79.